﻿@model SDCloudSolution.SDCloud.Web.Models.Model.ModelListViewModel

@{
    Layout = MVC.Shared.Views._AuthorizedLayout;
    ViewBag.Title = "Models gallery";
}

@section scripts {
    <script src="~/Scripts/js/libs/require/require.js"></script>
    <script src="~/Scripts/app.js"></script>
    <script src="~/Scripts/sdCloud/my.models.js"></script>
}

<div id="my-models-table">
    <h1 class="page-header">
        Models gallery
    </h1>    
    @if (Model.Items.Count > 0)
    {
        <div class="oj-flex oj-flex-items-pad">
            @foreach (var item in Model.Items)
            {
                <div class="oj-flex-item oj-sm-12 oj-lg-4 oj-md-5 oj-xl-3">
                    <div class="oj-panel oj-margin-bottom">
                        <div class="oj-header-border bold">
                            <a href="@Url.Action(MVC.ModelsGallery.View(item.ModelId))">
                                @item.Name
                            </a>
                        </div>
                        <br />
                        <div>
                            <a href="@Url.Action(MVC.Models.Download(item.ModelId))"
                               target="_blank"
                               data-bind="ojComponent: {
                                          component: 'ojButton',
                                          icons: {start:'fa fa-download'}
                                      }">
                                Download
                            </a>
                            <form method="POST" action="@Url.Action(MVC.ModelsGallery.CopyModelToPrivateCollection(item.ModelId))" style="display: inline-block;">
                                <button type="submit" data-bind="ojComponent: {
                                        component: 'ojButton',
                                        icons: { start: 'fa fa-copy'}
                                }">
                                    Copy
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            }            
        </div>
     }
     else
     {
       <p>
          Not any available models in gallery
       </p>
     }
</div>
